// src/router.js
const express = require('express')
//给req增加一个cookies属性
const cookieParser = require('cookie-parser')
//给req增加一个body属性
const bodyParser = require('body-parser')
//文件写入和读取用
const fs = require('fs')
const router = express.Router()
router.use(bodyParser.urlencoded({extended:false}))
router.use(cookieParser())

//login路由
router.post('/login',(req,res)=>{
  res.send(req.cookies);
})

//cookie路由
router.get('/cookie',(req,res)=>{
  res.send('cookie')
})

//cookie1路由
router.get('/cookie1',()=>{
  res.send('cookie1');
})
//cookie2路由
router.get('/cookie2', () => {
  res.send('cookie2');
})
//接口，用来把router传递出去
module.exports=router